/*
 * Before compilation and execution, understand what could be the output of the program.
 * Program demostrates how call by reference can impact values of calling functions.
 */

#include <stdio.h>

void
exchange(int **cc, int **dd)
{
	int t;

	t = **cc;
	**cc = **dd;
	**dd = t;
}

void
swap(int *cc, int *dd)
{
	exchange(&cc, &dd);
}

int main()
{
	int c = 10, d = 20;

	printf("Before swap, c = %d, d = %d\n", c, d);

	swap(&c, &d);
	printf("After swap, c = %d, d = %d\n", c, d);

	return 0;
}
